<template>
  <div>
    <custom-table
      :columns="columns"
      :query="queryParams"
      :head-btn="headBtn"
      :row-btn="rowBtn"
      v-bind="$attrs"
      v-on="listeners"
      :show-row-btn="['delete']"
     :show-head-btn="['flush','delete']"
      @tap-head-btn="onTapHeadBtn"
      @tap-row-btn="onTapRowBtn"
      @row-dblclick="onRowDbClick"
    >
    <!-- <template v-slot:address="{row}">
      <div style="color:red; background-color: aqua;">{{row.address}}内容</div>
    </template> -->
    </custom-table>
  </div>

</template>

<script>
import tableMixin from '@/utils/mixin/custom-table'

export default {
  data() {
    return {
      headBtn: [
        // {
        //   name: '刷新权限',
        //   // 类型
        //   type: 'primary',
        //   // 图标
        //   icon: 'el-icon-refresh-right',
        //   // 权限
        //   auth: this.getFullAuth('flush'),
        //   key: 'flushAuth'
        // }
      ],
      columns: [
        { name: '房间号', field: 'room_name', format(col, row) { return row.room.building.name + row.room.building.building_number + row.room_name } },
        { name: '记录者', field: 'user_id', format(col, row) { return row.real_name ? row.real_name : '管理员' } },
        { name: '上次水表读数', field: 'before_water', type: 'tag' },
        { name: '水表读数', field: 'water', type: 'tag' },
        { name: '上次电表读数', field: 'before_electricity', type: 'tag' },
        { name: '电表读数', field: 'electricity', type: 'tag' },
        { name: '记录日期', field: 'record_dates', type: 'tag' },
        // { name: '图片', field: 'image', type: 'image', width: 150 },
        // { name: '链接', field: 'link', type: 'link', width: 150 },
        // { name: '状态', field: 'status', label: true, type: this.checkAuth('change') ? 'switch' : 'tag', opts: {} },
        { name: '添加时间', field: 'create_time' }
      ]
    }
  },
  components: {},
  mixins: [
    tableMixin
  ],
  computed: {
    rowBtn() {
      return [
        // {
        //   name: '催收',
        //   key: 'notice',
        //   confirm: '确认进行发送催收通知吗？',
        //   show(row) {
        //     return row.status === '待缴费'
        //   }
        // }
      ]
    }
  },
  props: {},
  filters: {},
  created() {
  },
  methods: {
    onRowDbClick() {}
  }
}
</script>

<style lang="scss">

</style>
